package com.spy.material.controller;

import com.spy.common.core.domain.R;
import com.spy.material.dto.InventoryDetailQueryDTO;
import com.spy.material.dto.InventoryQueryDTO;
import com.spy.material.service.IInventoryDetailService;
import com.spy.material.vo.InventoryDetailPageVO;
import com.spy.material.vo.InventoryPageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.spy.common.annotation.Log;
import com.spy.common.core.controller.BaseController;
import com.spy.common.core.domain.AjaxResult;
import com.spy.common.enums.BusinessType;
import com.spy.material.domain.Inventory;
import com.spy.material.service.IInventoryService;
import com.spy.common.utils.poi.ExcelUtil;
import com.spy.common.core.page.TableDataInfo;

/**
 * 库存表Controller
 *
 * @author twc
 * @date 2025-11-09
 */
@RestController
@RequestMapping("/material/inventory")
@Api(tags = "库存表相关接口")
public class InventoryController extends BaseController
{
    @Autowired
    private IInventoryService inventoryService;
    @Autowired
    private IInventoryDetailService inventoryDetailService;


    @ApiOperation("分页查询库存表")
    @GetMapping("/page")
    public R<InventoryPageVO> page(InventoryQueryDTO inventoryQueryDTO){
        InventoryPageVO inventoryPageVO = inventoryService.all(inventoryQueryDTO);
        return R.ok(inventoryPageVO);
    }

    @ApiOperation("查询库存明细列表")
    @GetMapping("/detail/page")
    public R<InventoryDetailPageVO> all(@RequestBody InventoryDetailQueryDTO inventoryDetailQueryDTO) {
        InventoryDetailPageVO inventoryDetailPageVO = inventoryDetailService.all(inventoryDetailQueryDTO);
        return R.ok(inventoryDetailPageVO);
    }
}